From d7ba3f850484f5409f1a968629f252e6be89d824 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 28 Jun 2009 18:03:06 +0000 Subject: [PATCH] Try to preserve Ozi icon data in waypoints. --- ozi.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ozi.c b/ozi.c index 04ebf4aff..95418879d 100644 --- a/ozi.c +++ b/ozi.c @@ -484,7 +484,14 @@ ozi_parse_waypt(int field, char *str, waypoint * wpt_tmp, ozi_fsdata *fsdata) ozi_set_time_str(str, wpt_tmp); break; case 5: - /* icons 0-xx */ + /* icons 0-xx. Ozi seems to use some kind of internal tables to + pick numbers for icons based on GPS type. We don't know what those + tables are, so we read just the numbers. This converts badly to + other types, but it at least maintains fidelity for an ozi->ozi + operation. */ + if (str && isdigit(str[0])) { + wpt_tmp->icon_descr = xstrdup(str); + } break; case 6: /* unknown - always 1 */ @@ -803,6 +810,7 @@ ozi_waypt_pr(const waypoint * wpt) char *shortname; int faked_fsdata = 0; ozi_fsdata *fs = NULL; + int icon = 0; fs = (ozi_fsdata *) fs_chain_find(wpt->fs, FS_OZI); @@ -845,9 +853,13 @@ ozi_waypt_pr(const waypoint * wpt) index++; + if(wpt->icon_descr && isdigit(wpt->icon_descr[0])) { + icon = atoi(wpt->icon_descr); + } + gbfprintf(file_out, "%d,%s,%.6f,%.6f,%s,%d,%d,%d,%d,%d,%s,%d,%d,", - index, shortname, wpt->latitude, wpt->longitude, ozi_time, 0, + index, shortname, wpt->latitude, wpt->longitude, ozi_time, icon, 1, 3, fs->fgcolor, fs->bgcolor, description, 0, 0); if (WAYPT_HAS(wpt, proximity) && (wpt->proximity > 0)) gbfprintf(file_out, "%.1f,", wpt->proximity * prox_scale); -- 2.30.2